package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PopularScienceViewMapper;
import com.ruoyi.system.domain.PopularScienceView;
import com.ruoyi.system.service.IPopularScienceViewService;

/**
 * 科普知识与用户查看Service业务层处理
 *
 * @author ruoyi
 * @date 2023-09-08
 */
@Service
public class PopularScienceViewServiceImpl implements IPopularScienceViewService
{
    @Autowired
    private PopularScienceViewMapper popularScienceViewMapper;

    /**
     * 查询科普知识与用户查看
     *
     * @param id 科普知识与用户查看主键
     * @return 科普知识与用户查看
     */
    @Override
    public PopularScienceView selectPopularScienceViewById(Long id)
    {
        return popularScienceViewMapper.selectPopularScienceViewById(id);
    }

    /**
     * 查询科普知识与用户查看列表
     *
     * @param popularScienceView 科普知识与用户查看
     * @return 科普知识与用户查看
     */
    @Override
    public List<PopularScienceView> selectPopularScienceViewList(PopularScienceView popularScienceView)
    {
        return popularScienceViewMapper.selectPopularScienceViewList(popularScienceView);
    }

    /**
     * 新增科普知识与用户查看
     *
     * @param popularScienceView 科普知识与用户查看
     * @return 结果
     */
    @Override
    public int insertPopularScienceView(PopularScienceView popularScienceView)
    {
        popularScienceView.setCreateTime(DateUtils.getNowDate());
        return popularScienceViewMapper.insertPopularScienceView(popularScienceView);
    }

    /**
     * 修改科普知识与用户查看
     *
     * @param popularScienceView 科普知识与用户查看
     * @return 结果
     */
    @Override
    public int updatePopularScienceView(PopularScienceView popularScienceView)
    {
        popularScienceView.setUpdateTime(DateUtils.getNowDate());
        return popularScienceViewMapper.updatePopularScienceView(popularScienceView);
    }

    /**
     * 批量删除科普知识与用户查看
     *
     * @param ids 需要删除的科普知识与用户查看主键
     * @return 结果
     */
    @Override
    public int deletePopularScienceViewByIds(Long[] ids)
    {
        return popularScienceViewMapper.deletePopularScienceViewByIds(ids);
    }

    /**
     * 删除科普知识与用户查看信息
     *
     * @param id 科普知识与用户查看主键
     * @return 结果
     */
    @Override
    public int deletePopularScienceViewById(Long id)
    {
        return popularScienceViewMapper.deletePopularScienceViewById(id);
    }
}
